<template>
  <!-- 主体 -->
  <div class="withdraw_auth_content" :style="{ top: `${curTop}vh` }">
    <!-- 标题 -->
    <div class="dialog_title">
      <div class="left"></div>
      <div class="center">选择币种</div>
      <div class="right">
        <img
          @click="curTop = 100"
          src="@/assets/common/close_icon.png"
          alt=""
        />
      </div>
    </div>
    <!-- 内容 -->
    <div class="dialog_content">
      <div class="coins_tit">币种列表</div>
      <ul class="coins_list">
        <li
          v-for="(item, index) in coins"
          :key="index"
          @click="chooseCoin(item)"
        >
          <img
            :src="`https://qhzx-kline2.oss-ap-southeast-1.aliyuncs.com/logos/${item.name}.png`"
            alt=""
          />
          <div>{{ item.name }}</div>
        </li>
      </ul>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from "vue";

// 获取父组件属性和方法
defineProps(["coins"]);
const emits = defineEmits(["choose"]);
// 滑动
const curTop = ref(100);

// 显示抽屉
const showDrawer = (top: number) => {
  curTop.value = top;
};

// 选择币种
const chooseCoin = (row: any) => {
  emits("choose", row);
  curTop.value = 100
};

defineExpose({
  showDrawer,
});
</script>

<style lang="scss" scoped>
.withdraw_auth_content {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 90vh;
  background-color: #202126;
  border-radius: 15px;
  padding: 20px;
  transition: all 0.5s;
  .dialog_title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    .left,
    .right {
      width: 30px;
      height: 30px;
      display: flex;
      align-items: center;
      justify-content: center;
    }
  }
  .dialog_content {
    .coins_tit {
      margin: 10px 0;
    }
    .coins_list {
      li {
        display: flex;
        align-items: center;
        margin-bottom: 5px;
        padding: 5px;
        img {
          width: 30px;
          height: 30px;
          margin-right: 10px;
        }
      }
    }
  }
}
</style>
